<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>

	<body>
		<table border="1px"style="border-collapse:collapse;"width="200px">
			<tr>
				<td>1</td>
			</tr>
			<tr>
				<td>2</td>
			</tr>
			<tr>
				<td>3</td>
			</tr>
			<tr>
				<td>4</td>
			</tr>
			<tr>
				<td>5</td>
			</tr>
			<tr>
				<td>6</td>
			</tr>
		
		</table>
		<script type="text/javascript">
//			document.onmouseover = function(e) {
//				var e = e || window.event;
//				var target = e.target || e.srcElement;
//				if(target.tagName.toLowerCase() == "td") {
//					var rowIdx = target.parentNode.rowIndex + 1;
//					alert("第 " + rowIdx + " 行");
//				}
//			};
        var a=document.getElementsByTagName("tr");
        for(var i=0;i<a.length;i++){
        	a[i].onclick=(function(){
        		var rid=i;
        		return function(){
        			alert("第"+rid+"行");
        		}
        	})();
        }
		</script>
		
		
	</body>

</html>